package asteroids.model.programs.statements;

import exception.StopActionClassException;
import asteroids.model.programs.Expression;
import asteroids.model.programs.Program;

public class TurnStatement extends ActionStatement{
	
	public TurnStatement(Expression<?> angle){
		this.angle = angle;
	}
	
	private Expression<?> angle;

	@Override
	public void execute(Program program) throws StopActionClassException {
		if(!isExecuted()){
		program.getShip().turn((Double)angle.getValue(program));
		setExecuted();
		throw new StopActionClassException(this);
		}
	}

	

}
